package com.lushuan.ch11_springboot_test.demo.interface_and_abstract;

// 接口
interface Animal {
    void eat(); // 抽象方法

    default void sleep() { // 默认方法
        System.out.println("Sleeping...");
    }

    static void breathe() { // 静态方法
        System.out.println("Breathing...");
    }
}

// 实现接口
class Dog implements Animal {
    @Override
    public void eat() {
        System.out.println("Dog is eating...");
    }
}

public class InterfaceExample {
    public static void main(String[] args) {
        Dog dog = new Dog();
        dog.eat(); // 输出: Dog is eating...
        dog.sleep(); // 输出: Sleeping...
        Animal.breathe(); // 输出: Breathing...
    }
}
